<%@ page import="org.apmap.base.Flat" %>
<%@ page import="org.apmap.base.User" %>
<%@ page import="org.apmap.common.Currency" %>
<%@ page import="java.text.DecimalFormat" %>
<%@ page import="org.apmap.base.OfferType" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tags/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tags/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tags/struts-logic.tld" prefix="logic" %>
<%
    DecimalFormat decimalFormat = new DecimalFormat("#.##");
    Flat flat = (Flat) request.getAttribute("flat");
%>
<form action="javascript:saveForm('flatForm', '/saveflat.do')" style="font-family:Arial;font-size:10px" id="flatForm">
    <input type="hidden" name="flatid" value="<%=flat.getId()%>"/>
    тип
    <select name="type" style="font-family:Arial;font-size:10px">
        <option value="RENT" <%=flat.getType() == OfferType.RENT ? "selected" : ""%>>АРЕНДА</option>
        <option value="SALE" <%=flat.getType() == OfferType.SALE ? "selected" : ""%>>ПРОДАЖА</option>
    </select>

    адрес
    <input type="text" name="AD" value="<%=flat.getAddress()%>" size="50" style="font-family:Arial;font-size:10px">
    <br/>
    комнаты
    <select name="RN" style="font-family:Arial;font-size:10px">
        <option value="1" <%=flat.getRoomNumber() == 1 ? "selected" : ""%>>1</option>
        <option value="2" <%=flat.getRoomNumber() == 2 ? "selected" : ""%>>2</option>
        <option value="3" <%=flat.getRoomNumber() == 3 ? "selected" : ""%>>3</option>
        <option value="4" <%=flat.getRoomNumber() == 4 ? "selected" : ""%>>4</option>
        <option value="5" <%=flat.getRoomNumber() == 5 ? "selected" : ""%>>5</option>
    </select>
    цена <input type="text" name="price" value="<%=decimalFormat.format(flat.getPrice())%>" align="right" size="10" style="font-family:Arial;font-size:10px">
    <select name="CR" style="font-family:Arial;font-size:10px">
        <option value="USD" <%=flat.getCurrency() == Currency.USD ? "selected" : ""%>>USD</option>
        <option value="EUR" <%=flat.getCurrency() == Currency.EUR ? "selected" : ""%>>EUR</option>
        <option value="RUR" <%=flat.getCurrency() == Currency.RUR ? "selected" : ""%>>RUR</option>
    </select>
    <br/>

    площадь <input type="text" name="square" value="<%=flat.getSquare()%>" align="right" size="5" style="font-family:Arial;font-size:10px">
    этаж <input type="text" name="floor" value="<%=flat.getFloor()%>" size="2" style="font-family:Arial;font-size:10px"><br/>

    комментарии<br/>
    <textarea name="CM" rows="5" width="100%"><%=flat.getComment()%></textarea>
    <br/>

    <input type="submit" value="сохранить" style="font-family:Arial;font-size:10px">
    <input type="button" value="удалить" onclick="deleteFlat(<%=flat.getId()%>)" style="font-family:Arial;font-size:10px">
</form>
